package com.njh.charges.factory;

import com.hos.entity.sys.User;
import com.njh.charges.feigns.UserFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author: 陈海彬
 * @date: Created in 2023/12/12 14:42
 * @description:
 * @modified By:
 * @version:
 */
@Component
@Slf4j
public class MyUserFallbackFactory implements FallbackFactory<UserFeign> {
    @Override
    public UserFeign create(Throwable throwable) {
        return new UserFeign() {
            @Override
            public List<User> getUser(Map<String, Object> params) {
                log.error("根据参数获取用户列表出现异常");
                return null;
            }

            @Override
            public User selectUserByPhone(String phone) {
                log.error("根据手机号获取用户信息出现异常");
                return null;
            }

            @Override
            public User getUserById(Long userid) {
                log.error("根据用户id查找用户出现异常");
                return null;
            }
        };
    }
}